package com.jpa;

import com.bean.UserBean;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

/**
 * ========================
 * Created with IntelliJ IDEA.
 * User：恒宇少年
 * Date：2017/7/2
 * Time：18:39
 * 码云：http://git.oschina.net/jnyqy
 * ========================
 */
public interface UserJPA
        extends BaseJPA<UserBean>
{
    @Query(value = "select ifnull(max(id),1) from user",nativeQuery = true)
    public Long getMaxId();
    @Modifying
    @Query(value = "delete  from user where name like concat('%',?1,'%')",nativeQuery = true)
    @Transactional
    int delByName(String name);
}
